package com.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author 肖嘉亮
 * @version 1.0
 * @date 2021/4/15 9:26
 */
@RestController
@Slf4j
@RefreshScope
public class ConfigClientController {
    @Value(value = "${spring.application.name}")
    private String applicationName;

    @Value(value = "${config.label}")
    private String configLabel;

    @Value(value = "${config.info}")
    private String configInfo;

    @GetMapping(value = "/configInfo")
    public String getConfigInfo(){
        return configInfo;
    }

    /**
     * 获取config3344模块自己的配置文件属性
     * @return
     */
    @GetMapping(value = "/applicationName")
    public String applicationName(){
        return applicationName;
    }

    /**
     * 获取配置中心服务端的label属性
     * @return
     */
    @GetMapping(value = "/label")
    public String getLabel(){
        return configLabel;
    }
}
